package org.lagou.edu;

import org.lagou.edu.logSdk.utils.impl.SimpleOperationLogUtils;
import org.lagou.edu.pojo.Product;
import org.lagou.edu.service.ProductService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
@ComponentScan(basePackages = {"org.lagou.edu", "org.lagou.edu.logSdk"})    // 加入sdk的包扫描，让sdk中的的bean能够放入到IoC容器中
public class Main {
    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Main.class, args);

        ProductService productService = applicationContext.getBean(ProductService.class);

        // 新增测试
        Product product = new Product(12, "手机", 20);
        productService.addProduct(product);

        // 更新测试
        Product product1 = new Product(13, "手机", 20);
        productService.updateProduct(product1);

        // 删除测试
        productService.deleteProductById(14);

    }
}
